package com.wande.dataplatform.etl.node;

import lombok.Data;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * ETL执行上下文
 *
 * @author dataplatform
 */
@Data
public class EtlContext {

    /**
     * 任务ID
     */
    private Long taskId;

    /**
     * 实例ID
     */
    private Long instanceId;

    /**
     * 节点配置
     */
    private Map<String, Object> config;

    /**
     * 数据集
     */
    private List<Map<String, Object>> dataSet;

    /**
     * 上下文变量
     */
    private Map<String, Object> variables;

    /**
     * 统计信息
     */
    private EtlStatistics statistics;

    public EtlContext() {
        this.config = new HashMap<>();
        this.variables = new HashMap<>();
        this.statistics = new EtlStatistics();
    }

    /**
     * 设置变量
     */
    public void setVariable(String key, Object value) {
        this.variables.put(key, value);
    }

    /**
     * 获取变量
     */
    public Object getVariable(String key) {
        return this.variables.get(key);
    }
}
